package entity;

import lombok.Data;

import java.util.ArrayList;
import java.util.List;
import java.util.UUID;

@Data
public class Aria2 {
    /**
     * 方法名常量
     */
    public final static String METHOD_TELL_ACTIVE = "aria2.tellActive";
    public final static String METHOD_ADD_URI = "aria2.addUri";
    public final static String METHOD_GET_GLOBAL_STAT = "aria2.getGlobalStat";
    public final static String METHOD_TELL_STOPPED = "aria2.tellStopped";
    public final static String METHOD_TELL_WAITING = "aria2.tellWaiting";
    public final static String METHOD_REMOVE_DOWNLOAD_RESULT = "aria2.removeDownloadResult";
    private final static String[] PARAM_ARRAY_OF_FILED =
            new String[]{"totalLength", "completedLength", "files", "status", "errorCode", "gid"};

    private String jsonrpc = "2.0";
    private String method;
    private String id = UUID.randomUUID().toString();
    private List<Object> params = new ArrayList<>();


    /**
     * id随机生成，也可以手动设置
     */

    public Aria2() {

    }

    public void addParam(Object obj) {
        params.add(obj);
    }

    public Aria2(String[] urls) {
        this.method = METHOD_ADD_URI;
        params.add(urls);
    }
}
